:root {
    --product-card-padding: 1rem;
    --product-card-font-size: 14px;
    
    --product-card-header-background: #fbfbfb;
    --product-card-header-color: #191919;
    --product-card-footer-background: #fbfbfb;
    --product-card-footer-color: #191919;
    --product-card-background: #ffffff;
    --product-card-color: #191919;
    --product-card-avatar-border-color: #ffffff;
    --product-card-border-radius: 6px;
    --product-card-button-border-color: var(--border-color);

    --product-title-color: #191919;
    --product-status-color: #191919;
    --product-price-color: #191919;
}

.dark-side {
    --product-card-header-background: #282c35;
    --product-card-header-color: #fbfbfb;
    --product-card-footer-background: #282c35;
    --product-card-footer-color: #fbfbfb;
    --product-card-background: #2b2d30;
    --product-card-color: #dbdfe7;
    --product-card-avatar-border-color: #414245;
    --product-card-button-border-color: var(--border-color);

    --product-title-color: #dbdfe7;
    --product-status-color: #dbdfe7;
    --product-price-color: #dbdfe7;
}

.product-card {
    display: flex;
    flex-flow: column nowrap;
    position: relative;
    font-size: var( --product-card-font-size);
    border: 1px solid var(--border-color);
    border-radius: var(--product-card-border-radius);
    background: var(--product-card-background);
    color: var(--product-card-color);
    padding: var(--product-card-padding);
    height: 100%;

    .product-image {
        width: 100%;
        position: relative;
        display: block;
        padding-bottom: 100%;
        margin-bottom: 1rem;

        img {
            position: absolute;
            width: 100%;
            height: 100%;
            inset: 0;
            object-fit: scale-down;
        }
    }

    .product-title {
        --ratio: calc(19 / 14);
        --line-clamp: 2;

        font-size: calc(var( --product-card-font-size) * 1.14);
        font-weight: 400;
        display: -webkit-box;
        -webkit-line-clamp: var(--line-clamp);
        -webkit-box-orient: vertical;
        line-height: var(--ratio);
        overflow: hidden;
        word-break: break-word;
        color: var(--product-title-color, inherit);
    }

    .product-status {
        font-size: calc(var( --product-card-font-size) / 1.16);
        font-weight: 500;
        line-height: 16px;
        word-break: break-word;
        color: var(--product-status-color, inherit);
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        margin: .25rem 0;
        gap: 4px;

        .icon {
            font-size: calc(var( --product-card-font-size) * 1.25);
            width: calc(var( --product-card-font-size) * 1.25);
            height: calc(var( --product-card-font-size) * 1.25);
            line-height: calc(var( --product-card-font-size) * 1.25);
            display: flex;
            align-items: center;
            justify-content: center;
            object-fit: cover;
        }
    }

    .product-desc {
        font-size: 12px;
        font-weight: 400;
        line-height: 18px;
        word-break: break-word;
        text-wrap: pretty;
        display: -webkit-box;
    }

    .product-rating {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        margin: .5rem 0;
    }

    .-old {
        font-size: .6em;
        font-weight: 400;
        line-height: 12px;
        text-decoration: line-through;
    }

    .product-price {
        font-size: 16px;
        font-weight: 700;
        line-height: 20px;
    }

    .product-footer {
        display: flex;
        flex-flow: row nowrap;
        align-items: flex-start;
        margin-top: 1rem;
        height: 40px;
    }

    & > .badge {
        position: absolute;
        top: 10px;
        right: 10px;
        font-size: 14px;

        &.-left {
            left: 10px;
            right: auto;
        }
    }

    .product-props {
        display: none;
        position: absolute;
        top: calc(100% - 2px);
        left: -1rem;
        right: -1rem;
        padding: 0 1rem 1rem 1rem;
        background-color: var(--product-card-background);
        z-index: -1;
        box-shadow: 0 16px 16px #0000003d;
        border: 1px solid var(--border-color);
        border-top: none;
        border-radius:0 0 0.25rem 0.25rem;
    }

    &.hovered {
        &::before {
            content: '';
            display: none;
            position: absolute;
            top: -1rem;
            left: -1rem;
            right: -1rem;
            bottom: 0;
            border-radius: 0.25rem;
            background-color: var(--product-card-background);
            box-shadow: 0 16px 16px #0000003d;
            z-index: -1;
            border: 1px solid var(--border-color);
            border-bottom: none;
        }

        @media (hover: hover) {
            border: none;
            &:hover {
                z-index: 2;
                &::before {
                    display: block;
                }

                .product-props {
                    display: block;
                }
            }
        }
        
        @media (hover: none) {
            &:active {
                z-index: 2;
                &::before {
                    display: block;
                }

                .product-props {
                    display: block;
                }
            }
        }
    }
}


@container (width > 320px) {
    .product-card {
        --product-card-font-size: 11px;
        width: calc(50% - 4px);
    }
}

@container (width >= 540px) {
    .product-card {
        --product-card-font-size: 12px;
        width: calc(33% - 8px);
    }
}

@container (width >= 768px) {
    .product-card {
        --product-card-font-size: 11px;
        width: calc(25% - 12px);
    }
}

@container (width >= 1200px) {
    .product-card {
        --product-card-font-size: 14px;
        width: calc(20% - 16px);
    }
}

